2 * Shell Ordinal Functions
4 * These are completely undocumented. The meaning of the functions changes
5 * between different OS versions (NT uses Unicode strings, 95 uses ASCII
8 * They are just here so that explorer.exe and iexplore.exe can be tested.
10 * Copyright 1997 Marcus Meissner
27 #include "cursoricon.h"
28 #include "interfaces.h"
33 /*************************************************************************
34 * SHELL32_2 [SHELL32.2]
36 DWORD WINAPI
SHELL32_2(HWND32 hwnd
,DWORD x2
,DWORD x3
,DWORD x4
,DWORD x5
,DWORD x6
) {
37 FIXME(shell
,"(0x%04x,0x%08lx,0x%08lx,0x%08lx,0x%08lx,0x%08lx):stub.\n",
42 /*************************************************************************
43 * SHELL32_16 [SHELL32.16]
44 * find_lastitem_in_itemidlist()
47 * Original name: ILFindLast (exported by ordinal)
49 LPSHITEMID WINAPI
SHELL32_16(LPITEMIDLIST iil
) {
50 LPSHITEMID lastsii
,sii
;
58 sii
= (LPSHITEMID
)(((char*)sii
)+sii
->cb
);
63 /*************************************************************************
64 * SHELL32_29 [SHELL32.29]
65 * is_rootdir(const char*path)
68 * Original Name: PathIsRoot
70 BOOL32 WINAPI
SHELL32_29(LPCSTR x
) {
71 if (!strcmp(x
+1,":\\")) /* "X:\" */
73 if (!strcmp(x
,"\\")) /* "\" */
75 if (x
[0]=='\\' && x
[1]=='\\') { /* UNC "\\<xx>\" */
76 int foundbackslash
= 0;
82 if (foundbackslash
<=1) /* max 1 \ more ... */
88 /*************************************************************************
89 * SHELL32_30 [SHELL32.30]
90 * get_rootdir(char*path,int drive)
93 * Original Name: PathBuildRoot
95 LPSTR WINAPI
SHELL32_30(LPSTR root
,BYTE drive
) {
101 /*************************************************************************
102 * SHELL32_31 [SHELL32.31]
103 * returns pointer to last . in last pathcomponent or at \0.
105 LPSTR WINAPI
SHELL32_31(LPSTR path
) {
106 LPSTR lastpoint
= NULL
;
109 if (*path
=='\\'||*path
==' ')
115 return lastpoint
?lastpoint
:path
;
118 /*************************************************************************
119 * SHELL32_32 [SHELL32.32]
120 * append \ if there is none
122 LPSTR WINAPI
SHELL32_32(LPSTR path
) {
125 len
= lstrlen32A(path
);
126 if (len
&& path
[len
-1]!='\\') {
134 /*************************************************************************
135 * SHELL32_33 [SHELL32.33]
136 * remove spaces from beginning and end of passed string
138 LPSTR WINAPI
SHELL32_33(LPSTR str
) {
155 /*************************************************************************
156 * SHELL32_34 [SHELL32.34]
157 * basename(char *fn);
159 LPSTR WINAPI
SHELL32_34(LPSTR fn
) {
164 if (((fn
[0]=='\\') || (fn
[0]==':')) && fn
[1] && fn
[1]!='\\')
171 /*************************************************************************
172 * SHELL32_35 [SHELL32.35]
173 * bool getpath(char *pathname); truncates passed argument to a valid path
174 * returns if the string was modified or not.
175 * "\foo\xx\foo"-> "\foo\xx"
179 DWORD WINAPI
SHELL32_35(LPSTR fn
) {
195 continue; /* already x++ed */
213 /*************************************************************************
214 * SHELL32_37 [SHELL32.37]
215 * concat_paths(char*target,const char*add);
216 * concats "target\\add" and writes them to target
218 LPSTR WINAPI
SHELL32_37(LPSTR target
,LPSTR x1
,LPSTR x2
) {
222 lstrcpy32A(target
,x1
);
226 SHELL32_32(buf
); /* append \ if not there */
228 lstrcpy32A(target
,buf
);
232 /*************************************************************************
233 * SHELL32_36 [SHELL32.36]
234 * concat_paths(char*target,const char*add);
235 * concats "target\\add" and writes them to target
237 LPSTR WINAPI
SHELL32_36(LPSTR x1
,LPSTR x2
) {
238 while (x2
[0]=='\\') x2
++;
239 return SHELL32_37(x1
,x1
,x2
);
242 /*************************************************************************
243 * SHELL32_39 [SHELL32.39]
244 * isUNC(const char*path);
246 BOOL32 WINAPI
SHELL32_39(LPCSTR path
) {
247 if ((path
[0]=='\\') && (path
[1]=='\\'))
252 /*************************************************************************
253 * SHELL32_45 [SHELL32.45]
254 * file_exists(char *fn);
256 BOOL32 WINAPI
SHELL32_45(LPSTR fn
) {
257 if (GetFileAttributes32A(fn
)==-1)
263 /*************************************************************************
264 * SHELL32_51 [SHELL32.51]
266 DWORD WINAPI
SHELL32_51(LPCSTR s
,DWORD x2
,DWORD x3
) {
267 FIXME(shell
,"(%s,0x%08lx,0x%08lx),stub!\n",s
,x2
,x3
);
271 /*************************************************************************
272 * SHELL32_52 [SHELL32.52]
273 * look for next arg in string. handle "quoted" strings
274 * returns pointer to argument *AFTER* the space. Or to the \0.
276 LPSTR WINAPI
SHELL32_52(LPSTR cmdline
) {
277 BOOL32 qflag
= FALSE
;
280 if ((*cmdline
==' ') && !qflag
)
289 /*************************************************************************
290 * SHELL32_56 [SHELL32.56]
291 * unquote string (remove ")
293 VOID WINAPI
SHELL32_56(LPSTR str
) {
294 DWORD len
= lstrlen32A(str
);
296 if (*str
!='"') return;
297 if (str
[len
-1]!='"') return;
299 lstrcpy32A(str
,str
+1);
303 /*************************************************************************
304 * SHELL32_58 [SHELL32.58]
306 DWORD WINAPI
SHELL32_58(LPCSTR src
,DWORD x2
,LPSTR target
,DWORD pathlen
) {
307 FIXME(shell
,"(%s,0x%08lx,%p,%ld):stub.\n",
308 src
,x2
,target
,pathlen
315 /*************************************************************************
316 * SHELL32_62 [SHELL32.62]
318 DWORD WINAPI
SHELL32_62(DWORD x
,DWORD y
,DWORD z
,DWORD a
) {
319 FIXME(shell
,"(%08lx,%08lx,%08lx,%08lx):stub.\n",x
,y
,z
,a
);
323 /*************************************************************************
324 * SHELL32_63 [SHELL32.63]
326 DWORD WINAPI
SHELL32_63(HWND32 howner
, LPSTR targetbuf
, DWORD len
, DWORD x
, LPCSTR suffix
, LPCSTR y
, LPCSTR cmd
) {
327 FIXME(shell
,"(%04x,%p,%ld,%08lx,%s,%s,%s):stub.\n",
328 howner
,targetbuf
,len
,x
,suffix
,y
,cmd
330 /* puts up a Open Dialog and requests input into targetbuf */
331 /* OFN_HIDEREADONLY|OFN_NOCHANGEDIR|OFN_FILEMUSTEXIST|OFN_unknown */
332 lstrcpy32A(targetbuf
,"x:\\s3.exe");
336 /*************************************************************************
337 * SHELL32_68 [SHELL32.68]
339 DWORD WINAPI
SHELL32_68(DWORD x
,DWORD y
,DWORD z
) {
340 FIXME(shell
,"(0x%08lx,0x%08lx,0x%08lx):stub.\n",
345 /*************************************************************************
346 * SHELL32_71 [SHELL32.71]
347 * returns internal shell values in the passed pointers
349 BOOL32 WINAPI
SHELL32_71(LPDWORD x
,LPDWORD y
) {
351 FIXME(shell
,"(%p,%p):stub.\n",x
,y
);
355 /*************************************************************************
356 * SHELL32_72 [SHELL32.72]
357 * dunno. something with icons
359 void WINAPI
SHELL32_72(LPSTR x
,DWORD y
,DWORD z
) {
360 FIXME(shell
,"(%s,%08lx,%08lx):stub.\n",x
,y
,z
);
363 /*************************************************************************
364 * SHELL32_89 [SHELL32.89]
366 DWORD WINAPI
SHELL32_89(DWORD x1
,DWORD x2
,DWORD x3
) {
367 FIXME(shell
,"(0x%08lx,0x%08lx,0x%08lx):stub.\n",
373 /*************************************************************************
374 * SHELL32_119 [SHELL32.119]
377 void WINAPI
SHELL32_119(LPVOID x
) {
378 FIXME(shell
,"(%p(%s)):stub.\n",x
,(char *)x
);
381 /*************************************************************************
382 * SHELL32_175 [SHELL32.175]
385 void WINAPI
SHELL32_175(DWORD x1
,DWORD x2
,DWORD x3
,DWORD x4
) {
386 FIXME(shell
,"(0x%08lx,0x%08lx,0x%08lx,0x%08lx):stub.\n",
391 /*************************************************************************
392 * SHELL32_181 [SHELL32.181]
396 * hwnd [I] window handle
400 * Original name: RegisterShellHook (exported by ordinal)
402 void WINAPI
SHELL32_181(HWND32 hwnd
, DWORD y
) {
403 FIXME(shell
,"(0x%08lx,0x%08x):stub.\n",hwnd
,y
);
406 /*************************************************************************
407 * SHELL32_75 [SHELL32.75]
410 BOOL32 WINAPI
SHELL32_75(LPDWORD x
,LPDWORD y
) {
411 FIXME(shell
,"(%p,%p):stub.\n",x
,y
);
415 /*************************************************************************
416 * SHELL32_77 [SHELL32.77]
418 DWORD WINAPI
SHELL32_77(DWORD x
,DWORD y
,DWORD z
) {
419 FIXME(shell
,"(%08lx,%08lx,%08lx):stub.\n",x
,y
,z
);
423 /*************************************************************************
424 * SHELL32_79 [SHELL32.79]
425 * create_directory_and_notify(...)
427 DWORD WINAPI
SHELL32_79(LPCSTR dir
,LPVOID xvoid
) {
428 TRACE(shell
,"mkdir %s,%p\n",dir
,xvoid
);
429 if (!CreateDirectory32A(dir
,xvoid
))
431 /* SHChangeNotify(8,1,dir,0); */
435 typedef DWORD (* WINAPI GetClassPtr
)(REFCLSID
,REFIID
,LPVOID
);
437 static GetClassPtr
SH_find_moduleproc(LPSTR dllname
,HMODULE32
*xhmod
,
441 FARPROC32 dllunload
,nameproc
;
443 if (xhmod
) *xhmod
= 0;
444 if (!strcasecmp(SHELL32_34(dllname
),"shell32.dll"))
445 return (GetClassPtr
)SHELL32_DllGetClassObject
;
447 hmod
= LoadLibraryEx32A(dllname
,0,LOAD_WITH_ALTERED_SEARCH_PATH
);
450 dllunload
= GetProcAddress32(hmod
,"DllCanUnloadNow");
452 if (xhmod
) *xhmod
= hmod
;
453 nameproc
= GetProcAddress32(hmod
,name
);
458 /* register unloadable dll with unloadproc ... */
459 return (GetClassPtr
)nameproc
;
462 static DWORD
SH_get_instance(REFCLSID clsid
,LPSTR dllname
,
463 LPVOID unknownouter
,REFIID refiid
,LPVOID inst
465 GetClassPtr dllgetclassob
;
467 LPCLASSFACTORY classfac
;
469 dllgetclassob
= SH_find_moduleproc(dllname
,NULL
,"DllGetClassObject");
471 return 0x80070000|GetLastError();
475 hres = (*dllgetclassob)(clsid,(REFIID)&IID_IClassFactory,inst);
480 hres
= (*dllgetclassob
)(clsid
,(REFIID
)&IID_IClassFactory
,&classfac
);
481 if (hres
<0 || (hres
>=0x80000000))
484 FIXME(shell
,"no classfactory, but hres is 0x%ld!\n",hres
);
487 classfac
->lpvtbl
->fnCreateInstance(classfac
,unknownouter
,refiid
,inst
);
488 classfac
->lpvtbl
->fnRelease(classfac
);
492 /*************************************************************************
493 * SHELL32_102 [SHELL32.102]
496 LRESULT WINAPI
SHELL32_102(
497 LPSTR aclsid
,CLSID
*clsid
,LPUNKNOWN unknownouter
,REFIID refiid
,LPVOID inst
499 char buffer
[256],xclsid
[48],xiid
[48],path
[260],tmodel
[100];
501 DWORD pathlen
,type
,tmodellen
;
504 WINE_StringFromCLSID(refiid
,xiid
);
507 WINE_StringFromCLSID(clsid
,xclsid
);
511 strcpy(xclsid
,aclsid
);
513 TRACE(shell
,"(%p,%s,%p,%s,%p)\n",
514 aclsid
,xclsid
,unknownouter
,xiid
,inst
517 sprintf(buffer
,"CLSID\\%s\\InProcServer32",xclsid
);
518 if (RegOpenKeyEx32A(HKEY_CLASSES_ROOT
,buffer
,0,0x02000000,&inprockey
))
519 return SH_get_instance(clsid
,"shell32.dll",unknownouter
,refiid
,inst
);
520 pathlen
=sizeof(path
);
521 if (RegQueryValue32A(inprockey
,NULL
,path
,&pathlen
)) {
522 RegCloseKey(inprockey
);
523 return SH_get_instance(clsid
,"shell32.dll",unknownouter
,refiid
,inst
);
525 TRACE(shell
, "Server dll is %s\n",path
);
526 tmodellen
=sizeof(tmodel
);
528 if (RegQueryValueEx32A(inprockey
,"ThreadingModel",NULL
,&type
,tmodel
,&tmodellen
)) {
529 RegCloseKey(inprockey
);
530 return SH_get_instance(clsid
,"shell32.dll",unknownouter
,refiid
,inst
);
532 TRACE(shell
, "Threading model is %s\n",tmodel
);
533 hres
=SH_get_instance(clsid
,path
,unknownouter
,refiid
,inst
);
535 hres
=SH_get_instance(clsid
,"shell32.dll",unknownouter
,refiid
,inst
);
536 RegCloseKey(inprockey
);
541 /*************************************************************************
542 * SHELL32_183 [SHELL32.183]
543 * Format and output errormessage.
546 * Original name: ShellMessageBoxA
548 void __cdecl
SHELL32_183(HMODULE32 hmod
,HWND32 hwnd
,DWORD id
,DWORD x
,DWORD type
,LPVOID arglist
) {
549 char buf
[100],buf2
[100],*buf3
;
550 LPVOID args
= &arglist
;
552 if (!LoadString32A(hmod
,x
,buf
,100))
553 strcpy(buf
,"Desktop");
554 LoadString32A(hmod
,id
,buf2
,100);
555 /* FIXME: the varargs handling doesn't. */
556 FormatMessage32A(0x500,buf2
,0,0,(LPSTR
)&buf3
,256,(LPDWORD
)&args
);
558 FIXME(shell
,"(%08lx,%08lx,%08lx(%s),%08lx(%s),%08lx,%p):stub.\n",
559 (DWORD
)hmod
,(DWORD
)hwnd
,id
,buf2
,x
,buf
,type
,arglist
561 /*MessageBox32A(hwnd,buf3,buf,id|0x10000);*/
565 /*************************************************************************
566 * SHELL32_100 [SHELL32.100]
567 * walks through policy table, queries <app> key, <type> value, returns
568 * queried (DWORD) value.
569 * {0x00001,Explorer,NoRun}
570 * {0x00002,Explorer,NoClose}
571 * {0x00004,Explorer,NoSaveSettings}
572 * {0x00008,Explorer,NoFileMenu}
573 * {0x00010,Explorer,NoSetFolders}
574 * {0x00020,Explorer,NoSetTaskbar}
575 * {0x00040,Explorer,NoDesktop}
576 * {0x00080,Explorer,NoFind}
577 * {0x00100,Explorer,NoDrives}
578 * {0x00200,Explorer,NoDriveAutoRun}
579 * {0x00400,Explorer,NoDriveTypeAutoRun}
580 * {0x00800,Explorer,NoNetHood}
581 * {0x01000,Explorer,NoStartBanner}
582 * {0x02000,Explorer,RestrictRun}
583 * {0x04000,Explorer,NoPrinterTabs}
584 * {0x08000,Explorer,NoDeletePrinter}
585 * {0x10000,Explorer,NoAddPrinter}
586 * {0x20000,Explorer,NoStartMenuSubFolders}
587 * {0x40000,Explorer,MyDocsOnNet}
588 * {0x80000,WinOldApp,NoRealMode}
590 DWORD WINAPI
SHELL32_100(DWORD pol
) {
593 FIXME(shell
,"(%08lx):stub.\n",pol
);
594 if (RegOpenKey32A(HKEY_CURRENT_USER
,"Software\\Microsoft\\Windows\\CurrentVersion\\Policies",&xhkey
))
596 /* FIXME: do nothing for now, just return 0 (== "allowed") */
602 /*************************************************************************
603 * SHELL32_152 [SHELL32.152]
606 DWORD WINAPI
SHELL32_152(LPITEMIDLIST iil
) {
616 si
= (LPSHITEMID
)(((char*)si
)+si
->cb
);
621 /*************************************************************************
622 * SHELL32_158 [SHELL32.158]
624 LPSTR WINAPI
SHELL32_158(LPSTR path
,DWORD y
,DWORD z
) {
625 TRACE(shell
,"(%s,%08lx,%08lx)\n",path
,y
,z
);
626 path
= SHELL32_31(path
);
627 return *path
?(path
+1):path
;
630 /*************************************************************************
631 * SHELL32_165 [SHELL32.165]
632 * create_path_and_notify(...)
634 DWORD WINAPI
SHELL32_165(DWORD x
,LPCSTR path
) {
635 if (SHELL32_79(path
,(LPVOID
)x
))
637 FIXME(shell
,"(%08lx,%s):stub.\n",x
,path
);
641 /*************************************************************************
642 * SHELL32_195 [SHELL32.195]
643 * free_ptr() - frees memory using IMalloc
646 * Original name: SHFree (exported by ordinal)
648 DWORD WINAPI
SHELL32_195(LPVOID x
) {
649 return LocalFree32((HANDLE32
)x
);
652 /*************************************************************************
653 * SHELL32_196 [SHELL32.196]
654 * void *task_alloc(DWORD len), uses SHMalloc allocator
656 LPVOID WINAPI
SHELL32_196(DWORD len
) {
657 return (LPVOID
)LocalAlloc32(len
,LMEM_ZEROINIT
); /* FIXME */
660 /*************************************************************************
661 * SHELL32_18 [SHELL32.18]
664 LPITEMIDLIST WINAPI
SHELL32_18(LPITEMIDLIST iil
) {
668 len
= SHELL32_152(iil
);
669 newiil
= (LPITEMIDLIST
)SHELL32_196(len
);
671 memcpy(newiil
,iil
,len
);
675 /*************************************************************************
676 * SHELL32_25 [SHELL32.25]
679 LPITEMIDLIST WINAPI
SHELL32_25(LPITEMIDLIST iil1
,LPITEMIDLIST iil2
) {
683 len1
= SHELL32_152(iil1
)-2;
684 len2
= SHELL32_152(iil2
);
685 newiil
= SHELL32_196(len1
+len2
);
686 memcpy(newiil
,iil1
,len1
);
687 memcpy(((char*)newiil
)+len1
,iil2
,len2
);
691 /*************************************************************************
692 * SHELL32_155 [SHELL32.155]
693 * free_check_ptr - frees memory (if not NULL) allocated by SHMalloc allocator
696 * Original name: ILFree (exported by ordinal)
698 DWORD WINAPI
SHELL32_155(LPVOID x
) {
699 FIXME (shell
,"(0x%08lx):stub.\n", (DWORD
)x
);
702 // return SHELL32_195(x);
705 /*************************************************************************
706 * SHELL32_85 [SHELL32.85]
709 * Original name: OpenRegStream (exported by ordinal)
711 DWORD WINAPI
SHELL32_85(DWORD x1
,DWORD x2
,DWORD x3
,DWORD x4
) {
712 FIXME(shell
,"(0x%08lx,0x%08lx,0x%08lx,0x%08lx):stub.\n",
718 /*************************************************************************
719 * SHELL32_86 [SHELL32.86]
723 * Original name: SHRegisterDragDrop (exported by ordinal)
725 DWORD WINAPI
SHELL32_86(HWND32 hwnd
,DWORD x2
) {
726 FIXME (shell
, "(0x%08lx,0x%08x):stub.\n", hwnd
, x2
);
730 /*************************************************************************
731 * SHELL32_87 [SHELL32.87]
735 * Original name: SHRevokeDragDrop (exported by ordinal)
737 DWORD WINAPI
SHELL32_87(DWORD x
) {
738 FIXME(shell
,"(0x%08lx):stub.\n",x
);
743 /*************************************************************************
744 * SHELL32_61 [SHELL32.61]
747 * Original name: RunFileDlg (exported by ordinal)
750 SHELL32_61 (HWND32 hwndOwner
, DWORD dwParam1
, DWORD dwParam2
,
751 LPSTR lpszTitle
, LPSTR lpszPrompt
, UINT32 uFlags
)
753 FIXME (shell
,"(0x%08x 0x%lx 0x%lx \"%s\" \"%s\" 0x%x):stub.\n",
754 hwndOwner
, dwParam1
, dwParam2
, lpszTitle
, lpszPrompt
, uFlags
);
759 /*************************************************************************
760 * SHELL32_60 [SHELL32.60]
761 * Shell/Shutdown-Dialog
764 SHELL32_60 (HWND32 hwndOwner
)
766 FIXME (shell
,"(0x%08x):stub.\n", hwndOwner
);
771 /*************************************************************************
772 * SHELL32_184 [SHELL32.184]
776 SHELL32_184 (DWORD dwParam1
, DWORD dwParam2
, DWORD dwParam3
,
777 DWORD dwParam4
, DWORD dwParam5
)
779 FIXME (shell
,"(0x%lx 0x%lx 0x%lx 0x%lx 0x%lx):stub.\n",
780 dwParam1
, dwParam2
, dwParam3
, dwParam4
, dwParam5
);
785 /*************************************************************************
786 * SHELL32_147 [SHELL32.147]
789 * Original name: SHCLSIDFromString (exported by ordinal)
792 SHELL32_147 (DWORD dwParam1
, DWORD dwParam2
)
794 FIXME (shell
,"(0x%lx 0x%lx):stub.\n", dwParam1
, dwParam2
);