2 * Copyright 2010 Jacek Caban for CodeWeavers
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.
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.
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
26 #include <wine/debug.h>
27 #include <wine/unicode.h>
29 WINE_DEFAULT_DEBUG_CHANNEL(wscript
);
31 static BOOL
get_engine_clsid(const WCHAR
*ext
, CLSID
*clsid
)
33 WCHAR fileid
[64], progid
[64];
39 static const WCHAR script_engineW
[] =
40 {'\\','S','c','r','i','p','t','E','n','g','i','n','e',0};
42 res
= RegOpenKeyW(HKEY_CLASSES_ROOT
, ext
, &hkey
);
43 if(res
!= ERROR_SUCCESS
)
46 size
= sizeof(fileid
)/sizeof(WCHAR
);
47 res
= RegQueryValueW(hkey
, NULL
, fileid
, &size
);
49 if(res
!= ERROR_SUCCESS
)
52 WINE_TRACE("fileid is %s\n", wine_dbgstr_w(fileid
));
54 strcatW(fileid
, script_engineW
);
55 res
= RegOpenKeyW(HKEY_CLASSES_ROOT
, fileid
, &hkey
);
56 if(res
!= ERROR_SUCCESS
)
59 size
= sizeof(progid
)/sizeof(WCHAR
);
60 res
= RegQueryValueW(hkey
, NULL
, progid
, &size
);
62 if(res
!= ERROR_SUCCESS
)
65 WINE_TRACE("ProgID is %s\n", wine_dbgstr_w(progid
));
67 hres
= CLSIDFromProgID(progid
, clsid
);
68 return SUCCEEDED(hres
);
71 int WINAPI
wWinMain(HINSTANCE hInst
, HINSTANCE hPrevInst
, LPWSTR cmdline
, int cmdshow
)
76 WINE_FIXME("(%p %p %s %x)\n", hInst
, hPrevInst
, wine_dbgstr_w(cmdline
), cmdshow
);
81 ext
= strchrW(cmdline
, '.');
84 if(!get_engine_clsid(ext
, &clsid
)) {
85 WINE_FIXME("Could not fine engine for %s\n", wine_dbgstr_w(ext
));