xref: /reactos/dll/win32/url/url_main.c (revision c2c66aff)
1 /*
2  * Copyright 2006 Alexandre Julliard
3  *
4  * This library is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU Lesser General Public
6  * License as published by the Free Software Foundation; either
7  * version 2.1 of the License, or (at your option) any later version.
8  *
9  * This library is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12  * Lesser General Public License for more details.
13  *
14  * You should have received a copy of the GNU Lesser General Public
15  * License along with this library; if not, write to the Free Software
16  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
17  */
18 
19 #define WIN32_NO_STATUS
20 #define _INC_WINDOWS
21 #define COM_NO_WINDOWS_H
22 
23 #include <stdarg.h>
24 #include <windef.h>
25 #include <winbase.h>
26 #include <winreg.h>
27 //#include "winerror.h"
28 #include <shellapi.h>
29 #include <shlwapi.h>
30 //#include "intshcut.h"
31 #include <winuser.h>
32 //#include "commctrl.h"
33 #include <prsht.h>
34 #include <wine/debug.h>
35 
36 WINE_DEFAULT_DEBUG_CHANNEL(url);
37 
38 /***********************************************************************
39  *		DllMain  (URL.@)
40  */
41 BOOL WINAPI DllMain( HINSTANCE inst, DWORD reason, LPVOID reserved )
42 {
43     switch(reason)
44     {
45     case DLL_WINE_PREATTACH:
46         return FALSE;  /* prefer native version */
47     case DLL_PROCESS_ATTACH:
48         DisableThreadLibraryCalls( inst );
49         break;
50     }
51     return TRUE;
52 }
53 
54 /***********************************************************************
55  * AddMIMEFileTypesPS (URL.@)
56  *
57  * Build and Manage a Filetype-Association Property Sheet
58  *
59  * PARAMS
60  *  unknown1 [I] Pointer to an Read-Only Area
61  *  lppsh    [I] PTR to the target PropertySheetHeader (ANSI)
62  *
63  * RETURNS
64  *  Success: 0
65  *
66  */
67 DWORD WINAPI AddMIMEFileTypesPS(VOID * unknown1, LPPROPSHEETHEADERA lppsh)
68 {
69     FIXME("(%p, %p): stub!\n", unknown1, lppsh);
70     return 0;
71 }
72 
73 /***********************************************************************
74  * InetIsOffline    (URL.@)
75  *
76  */
77 BOOL WINAPI InetIsOffline(DWORD flags)
78 {
79     FIXME("(%08x): stub!\n", flags);
80 
81     return FALSE;
82 }
83 
84 /***********************************************************************
85  * FileProtocolHandlerA    (URL.@)
86  *
87  * Handles a URL given to it and executes it.
88  *
89  * HWND hWnd - Parent Window
90  * HINSTANCE hInst - ignored
91  * LPCSTR pszUrl - The URL that needs to be handled
92  * int nShowCmd - How to display the operation.
93  */
94 
95 void WINAPI FileProtocolHandlerA(HWND hWnd, HINSTANCE hInst, LPCSTR pszUrl, int nShowCmd)
96 {
97     CHAR pszPath[MAX_PATH];
98     DWORD size = MAX_PATH;
99     HRESULT createpath = PathCreateFromUrlA(pszUrl,pszPath,&size,0);
100 
101     TRACE("(%p, %s, %d)\n",hWnd,debugstr_a(pszUrl),nShowCmd);
102 
103     ShellExecuteA(hWnd, NULL, createpath==S_OK ? pszPath : pszUrl, NULL, NULL, nShowCmd);
104 }
105 
106 /***********************************************************************
107  * OpenURLA    (URL.@)
108  *
109  */
110 void WINAPI OpenURLA(HWND hwnd, HINSTANCE inst, LPCSTR cmdline, INT show)
111 {
112     FIXME("(%p, %p, %s, %d): stub!\n", hwnd, inst, debugstr_a(cmdline), show);
113 }
114 
115 /***********************************************************************
116  * TelnetProtocolHandlerA    (URL.@)
117  *
118  */
119 
120 HRESULT WINAPI TelnetProtocolHandlerA(HWND hWnd, LPSTR lpStr)
121 {
122     FIXME("(%p, %p): stub!\n",hWnd,lpStr);
123 
124     return E_NOTIMPL;
125 }
126