2 * Copyright 2008 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
37 #include "wine/debug.h"
39 WINE_DEFAULT_DEBUG_CHANNEL(jscript);
41 static const CLSID CLSID_JScript =
42 {0xf414c260,0x6ac0,0x11cf,{0xb6,0xd1,0x00,0xaa,0x00,0xbb,0xbb,0x58}};
43 static const CLSID CLSID_JScriptAuthor =
44 {0xf414c261,0x6ac0,0x11cf,{0xb6,0xd1,0x00,0xaa,0x00,0xbb,0xbb,0x58}};
45 static const CLSID CLSID_JScriptEncode =
46 {0xf414c262,0x6ac0,0x11cf,{0xb6,0xd1,0x00,0xaa,0x00,0xbb,0xbb,0x58}};
48 static HINSTANCE jscript_hinstance;
50 /******************************************************************
53 BOOL WINAPI DllMain(HINSTANCE hInstDLL, DWORD fdwReason, LPVOID lpv)
55 TRACE("(%p %d %p)\n", hInstDLL, fdwReason, lpv);
59 case DLL_WINE_PREATTACH:
60 return FALSE; /* prefer native version */
61 case DLL_PROCESS_ATTACH:
62 DisableThreadLibraryCalls(hInstDLL);
63 jscript_hinstance = hInstDLL;
70 /***********************************************************************
71 * DllGetClassObject (jscript.@)
73 HRESULT WINAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID *ppv)
75 FIXME("%s %s %p\n", debugstr_guid(rclsid), debugstr_guid(riid), ppv);
76 return CLASS_E_CLASSNOTAVAILABLE;
79 /***********************************************************************
80 * DllCanUnloadNow (jscript.@)
82 HRESULT WINAPI DllCanUnloadNow(void)
88 /***********************************************************************
92 #define INF_SET_ID(id) \
95 static CHAR name[] = #id; \
97 pse[i].pszName = name; \
101 static HRESULT register_inf(BOOL doregister)
105 HRESULT (WINAPI *pRegInstall)(HMODULE hm, LPCSTR pszSection, const STRTABLEA* pstTable);
108 static CLSID const *clsids[7];
111 static const WCHAR advpackW[] = {'a','d','v','p','a','c','k','.','d','l','l',0};
113 INF_SET_ID(CLSID_JScript);
114 INF_SET_ID(CLSID_JScriptAuthor);
115 INF_SET_ID(CLSID_JScriptEncode);
116 INF_SET_ID(CATID_ActiveScript);
117 INF_SET_ID(CATID_ActiveScriptParse);
118 INF_SET_ID(CATID_ActiveScriptEncode);
119 INF_SET_ID(CATID_ActiveScriptAuthor);
121 for(i = 0; i < sizeof(pse)/sizeof(pse[0]); i++) {
122 pse[i].pszValue = HeapAlloc(GetProcessHeap(), 0, 39);
123 sprintf(pse[i].pszValue, "{%08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x}",
124 clsids[i]->Data1, clsids[i]->Data2, clsids[i]->Data3, clsids[i]->Data4[0],
125 clsids[i]->Data4[1], clsids[i]->Data4[2], clsids[i]->Data4[3], clsids[i]->Data4[4],
126 clsids[i]->Data4[5], clsids[i]->Data4[6], clsids[i]->Data4[7]);
129 strtable.cEntries = sizeof(pse)/sizeof(pse[0]);
132 hAdvpack = LoadLibraryW(advpackW);
133 pRegInstall = (void *)GetProcAddress(hAdvpack, "RegInstall");
135 hres = pRegInstall(jscript_hinstance, doregister ? "RegisterDll" : "UnregisterDll", &strtable);
137 for(i=0; i < sizeof(pse)/sizeof(pse[0]); i++)
138 HeapFree(GetProcessHeap(), 0, pse[i].pszValue);
145 /***********************************************************************
146 * DllRegisterServer (jscript.@)
148 HRESULT WINAPI DllRegisterServer(void)
151 return register_inf(TRUE);
154 /***********************************************************************
155 * DllUnregisterServer (jscript.@)
157 HRESULT WINAPI DllUnregisterServer(void)
160 return register_inf(FALSE);