2 * Copyright 2005 Jacek Caban
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
34 #include "wine/debug.h"
35 #include "wine/unicode.h"
37 WINE_DEFAULT_DEBUG_CHANNEL(atl);
39 static LONG dll_count;
41 /**************************************************************
42 * ATLRegistrar implementation
49 {{'H','K','E','Y','_','C','L','A','S','S','E','S','_','R','O','O','T',0},
51 {{'H','K','E','Y','_','C','U','R','R','E','N','T','_','U','S','E','R',0},
53 {{'H','K','E','Y','_','L','O','C','A','L','_','M','A','C','H','I','N','E',0},
55 {{'H','K','E','Y','_','U','S','E','R','S',0},
57 {{'H','K','E','Y','_','P','E','R','F','O','R','M','A','N','C','E','_','D','A','T','A',0},
58 HKEY_PERFORMANCE_DATA},
59 {{'H','K','E','Y','_','D','Y','N','_','D','A','T','A',0},
61 {{'H','K','E','Y','_','C','U','R','R','E','N','T','_','C','O','N','F','I','G',0},
63 {{'H','K','C','R',0}, HKEY_CLASSES_ROOT},
64 {{'H','K','C','U',0}, HKEY_CURRENT_USER},
65 {{'H','K','L','M',0}, HKEY_LOCAL_MACHINE},
66 {{'H','K','U',0}, HKEY_USERS},
67 {{'H','K','P','D',0}, HKEY_PERFORMANCE_DATA},
68 {{'H','K','D','D',0}, HKEY_DYN_DATA},
69 {{'H','K','C','C',0}, HKEY_CURRENT_CONFIG}
72 typedef struct rep_list_str {
76 struct rep_list_str *next;
80 IRegistrar IRegistrar_iface;
91 static inline Registrar *impl_from_IRegistrar(IRegistrar *iface)
93 return CONTAINING_RECORD(iface, Registrar, IRegistrar_iface);
96 static void strbuf_init(strbuf *buf)
98 buf->str = HeapAlloc(GetProcessHeap(), 0, 128*sizeof(WCHAR));
103 static void strbuf_write(LPCOLESTR str, strbuf *buf, int len)
107 if(buf->len+len+1 >= buf->alloc) {
108 buf->alloc = (buf->len+len)<<1;
109 buf->str = HeapReAlloc(GetProcessHeap(), 0, buf->str, buf->alloc*sizeof(WCHAR));
111 memcpy(buf->str+buf->len, str, len*sizeof(OLECHAR));
113 buf->str[buf->len] = '\0';
116 static HRESULT get_word(LPCOLESTR *str, strbuf *buf)
118 LPCOLESTR iter, iter2 = *str;
123 while(isspaceW(*iter2))
131 if(*iter == '}' || *iter == '=') {
132 strbuf_write(iter++, buf, 1);
133 }else if(*iter == '\'') {
135 iter = strchrW(iter, '\'');
137 WARN("Unexpected end of script\n");
139 return DISP_E_EXCEPTION;
141 strbuf_write(iter2, buf, iter-iter2);
144 while(*iter && !isspaceW(*iter))
146 strbuf_write(iter2, buf, iter-iter2);
149 while(isspaceW(*iter))
155 static HRESULT do_preprocess(const Registrar *This, LPCOLESTR data, strbuf *buf)
157 LPCOLESTR iter, iter2 = data;
159 static const WCHAR wstr[] = {'%',0};
161 iter = strchrW(data, '%');
163 strbuf_write(iter2, buf, iter-iter2);
167 return DISP_E_EXCEPTION;
168 iter = strchrW(iter2, '%');
170 return DISP_E_EXCEPTION;
173 strbuf_write(wstr, buf, 1);
175 for(rep_iter = This->rep; rep_iter; rep_iter = rep_iter->next) {
176 if(rep_iter->key_len == iter-iter2
177 && !memicmpW(iter2, rep_iter->key, rep_iter->key_len))
181 WARN("Could not find replacement: %s\n", debugstr_wn(iter2, iter-iter2));
182 return DISP_E_EXCEPTION;
185 strbuf_write(rep_iter->item, buf, -1);
189 iter = strchrW(iter, '%');
192 strbuf_write(iter2, buf, -1);
193 TRACE("%s\n", debugstr_w(buf->str));
198 static HRESULT do_process_key(LPCOLESTR *pstr, HKEY parent_key, strbuf *buf, BOOL do_register)
200 LPCOLESTR iter = *pstr;
214 static const WCHAR wstrNoRemove[] = {'N','o','R','e','m','o','v','e',0};
215 static const WCHAR wstrForceRemove[] = {'F','o','r','c','e','R','e','m','o','v','e',0};
216 static const WCHAR wstrDelete[] = {'D','e','l','e','t','e',0};
217 static const WCHAR wstrval[] = {'v','a','l',0};
220 hres = get_word(&iter, buf);
225 while(buf->str[1] || buf->str[0] != '}') {
227 if(!lstrcmpiW(buf->str, wstrNoRemove))
228 key_type = NO_REMOVE;
229 else if(!lstrcmpiW(buf->str, wstrForceRemove))
230 key_type = FORCE_REMOVE;
231 else if(!lstrcmpiW(buf->str, wstrval))
233 else if(!lstrcmpiW(buf->str, wstrDelete))
234 key_type = DO_DELETE;
236 if(key_type != NORMAL) {
237 hres = get_word(&iter, buf);
241 TRACE("name = %s\n", debugstr_w(buf->str));
244 if(key_type == IS_VAL) {
246 strbuf_write(buf->str, &name, -1);
247 }else if(key_type == DO_DELETE) {
248 TRACE("Deleting %s\n", debugstr_w(buf->str));
249 RegDeleteTreeW(parent_key, buf->str);
251 if(key_type == FORCE_REMOVE)
252 RegDeleteTreeW(parent_key, buf->str);
253 lres = RegCreateKeyW(parent_key, buf->str, &hkey);
254 if(lres != ERROR_SUCCESS) {
255 WARN("Could not create(open) key: %08x\n", lres);
256 hres = HRESULT_FROM_WIN32(lres);
260 }else if(key_type != IS_VAL && key_type != DO_DELETE) {
261 strbuf_write(buf->str, &name, -1);
262 lres = RegOpenKeyW(parent_key, buf->str, &hkey);
263 if(lres != ERROR_SUCCESS)
264 WARN("Could not open key %s: %08x\n", debugstr_w(name.str), lres);
267 if(key_type != DO_DELETE && *iter == '=') {
269 hres = get_word(&iter, buf);
273 WARN("Wrong registry type: %s\n", debugstr_w(buf->str));
274 hres = DISP_E_EXCEPTION;
278 switch(buf->str[0]) {
280 hres = get_word(&iter, buf);
283 lres = RegSetValueExW(hkey, name.len ? name.str : NULL, 0, REG_SZ, (PBYTE)buf->str,
284 (lstrlenW(buf->str)+1)*sizeof(WCHAR));
285 if(lres != ERROR_SUCCESS) {
286 WARN("Could set value of key: %08x\n", lres);
287 hres = HRESULT_FROM_WIN32(lres);
293 hres = get_word(&iter, buf);
296 dw = atoiW(buf->str);
297 lres = RegSetValueExW(hkey, name.len ? name.str : NULL, 0, REG_DWORD,
298 (PBYTE)&dw, sizeof(dw));
299 if(lres != ERROR_SUCCESS) {
300 WARN("Could set value of key: %08x\n", lres);
301 hres = HRESULT_FROM_WIN32(lres);
310 hres = get_word(&iter, buf);
313 count = (lstrlenW(buf->str) + 1) / 2;
314 bytes = HeapAlloc(GetProcessHeap(), 0, count);
316 hres = E_OUTOFMEMORY;
319 for(i = 0; i < count && buf->str[2*i]; i++) {
321 if(!isxdigitW(buf->str[2*i]) || !isxdigitW(buf->str[2*i + 1])) {
325 digits[0] = buf->str[2*i];
326 digits[1] = buf->str[2*i + 1];
328 bytes[i] = (BYTE) strtoulW(digits, NULL, 16);
330 if(SUCCEEDED(hres)) {
331 lres = RegSetValueExW(hkey, name.len ? name.str : NULL, 0, REG_BINARY,
333 if(lres != ERROR_SUCCESS) {
334 WARN("Could not set value of key: 0x%08x\n", lres);
335 hres = HRESULT_FROM_WIN32(lres);
338 HeapFree(GetProcessHeap(), 0, bytes);
342 WARN("Wrong resource type: %s\n", debugstr_w(buf->str));
343 hres = DISP_E_EXCEPTION;
350 hres = get_word(&iter, buf);
354 }else if(key_type == IS_VAL) {
355 WARN("value not set!\n");
356 hres = DISP_E_EXCEPTION;
360 if(key_type != IS_VAL && key_type != DO_DELETE && *iter == '{' && isspaceW(iter[1])) {
361 hres = get_word(&iter, buf);
364 hres = do_process_key(&iter, hkey, buf, do_register);
369 TRACE("%x %x\n", do_register, key_type);
370 if(!do_register && (key_type == NORMAL || key_type == FORCE_REMOVE)) {
371 TRACE("Deleting %s\n", debugstr_w(name.str));
372 RegDeleteKeyW(parent_key, name.str);
375 if(hkey && key_type != IS_VAL)
380 hres = get_word(&iter, buf);
385 HeapFree(GetProcessHeap(), 0, name.str);
386 if(hkey && key_type != IS_VAL)
392 static HRESULT do_process_root_key(LPCOLESTR data, BOOL do_register)
394 LPCOLESTR iter = data;
400 hres = get_word(&iter, &buf);
406 WARN("ward.len == 0, failed\n");
407 hres = DISP_E_EXCEPTION;
410 for(i=0; i<sizeof(root_keys)/sizeof(root_keys[0]); i++) {
411 if(!lstrcmpiW(buf.str, root_keys[i].name))
414 if(i == sizeof(root_keys)/sizeof(root_keys[0])) {
415 WARN("Wrong root key name: %s\n", debugstr_w(buf.str));
416 hres = DISP_E_EXCEPTION;
419 hres = get_word(&iter, &buf);
422 if(buf.str[1] || buf.str[0] != '{') {
423 WARN("Failed, expected '{', got %s\n", debugstr_w(buf.str));
424 hres = DISP_E_EXCEPTION;
427 hres = do_process_key(&iter, root_keys[i].key, &buf, do_register);
429 WARN("Processing key failed: %08x\n", hres);
432 hres = get_word(&iter, &buf);
436 HeapFree(GetProcessHeap(), 0, buf.str);
440 static HRESULT string_register(Registrar *This, LPCOLESTR data, BOOL do_register)
445 TRACE("(%p %s %x)\n", This, debugstr_w(data), do_register);
448 hres = do_preprocess(This, data, &buf);
450 WARN("preprocessing failed!\n");
451 HeapFree(GetProcessHeap(), 0, buf.str);
455 hres = do_process_root_key(buf.str, do_register);
456 if(FAILED(hres) && do_register)
457 do_process_root_key(buf.str, FALSE);
459 HeapFree(GetProcessHeap(), 0, buf.str);
463 static HRESULT resource_register(Registrar *This, LPCOLESTR resFileName,
464 LPCOLESTR szID, LPCOLESTR szType, BOOL do_register)
473 hins = LoadLibraryExW(resFileName, NULL, LOAD_LIBRARY_AS_DATAFILE);
475 src = FindResourceW(hins, szID, szType);
477 regstra = LoadResource(hins, src);
478 reslen = SizeofResource(hins, src);
480 len = MultiByteToWideChar(CP_ACP, 0, regstra, reslen, NULL, 0)+1;
481 regstrw = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, len*sizeof(WCHAR));
482 MultiByteToWideChar(CP_ACP, 0, regstra, reslen, regstrw, len);
483 regstrw[len-1] = '\0';
485 hres = string_register(This, regstrw, do_register);
487 HeapFree(GetProcessHeap(), 0, regstrw);
489 WARN("could not load resource\n");
490 hres = HRESULT_FROM_WIN32(GetLastError());
493 WARN("Could not find source\n");
494 hres = HRESULT_FROM_WIN32(GetLastError());
498 WARN("Could not load resource file\n");
499 hres = HRESULT_FROM_WIN32(GetLastError());
505 static HRESULT file_register(Registrar *This, LPCOLESTR fileName, BOOL do_register)
514 file = CreateFileW(fileName, GENERIC_READ, 0, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_READONLY, NULL);
515 if(file != INVALID_HANDLE_VALUE) {
516 filelen = GetFileSize(file, NULL);
517 regstra = HeapAlloc(GetProcessHeap(), 0, filelen);
518 lres = ReadFile(file, regstra, filelen, NULL, NULL);
519 if(lres == ERROR_SUCCESS) {
520 len = MultiByteToWideChar(CP_ACP, 0, regstra, filelen, NULL, 0)+1;
521 regstrw = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, len*sizeof(WCHAR));
522 MultiByteToWideChar(CP_ACP, 0, regstra, filelen, regstrw, len);
523 regstrw[len-1] = '\0';
525 hres = string_register(This, regstrw, do_register);
527 HeapFree(GetProcessHeap(), 0, regstrw);
529 WARN("Failed to read faile\n");
530 hres = HRESULT_FROM_WIN32(lres);
532 HeapFree(GetProcessHeap(), 0, regstra);
535 WARN("Could not open file\n");
536 hres = HRESULT_FROM_WIN32(GetLastError());
542 static HRESULT WINAPI Registrar_QueryInterface(IRegistrar *iface, REFIID riid, void **ppvObject)
544 TRACE("(%p)->(%s %p\n", iface, debugstr_guid(riid), ppvObject);
546 if(IsEqualGUID(&IID_IUnknown, riid) || IsEqualGUID(&IID_IRegistrar, riid)) {
547 IRegistrar_AddRef(iface);
551 return E_NOINTERFACE;
554 static ULONG WINAPI Registrar_AddRef(IRegistrar *iface)
556 Registrar *This = impl_from_IRegistrar(iface);
557 ULONG ref = InterlockedIncrement(&This->ref);
558 TRACE("(%p) ->%d\n", This, ref);
562 static ULONG WINAPI Registrar_Release(IRegistrar *iface)
564 Registrar *This = impl_from_IRegistrar(iface);
565 ULONG ref = InterlockedDecrement(&This->ref);
567 TRACE("(%p) ->%d\n", This, ref);
569 IRegistrar_ClearReplacements(iface);
570 HeapFree(GetProcessHeap(), 0, This);
571 InterlockedDecrement(&dll_count);
576 static HRESULT WINAPI Registrar_AddReplacement(IRegistrar *iface, LPCOLESTR Key, LPCOLESTR item)
578 Registrar *This = impl_from_IRegistrar(iface);
582 TRACE("(%p)->(%s %s)\n", This, debugstr_w(Key), debugstr_w(item));
584 new_rep = HeapAlloc(GetProcessHeap(), 0, sizeof(rep_list));
586 new_rep->key_len = lstrlenW(Key);
587 new_rep->key = HeapAlloc(GetProcessHeap(), 0, (new_rep->key_len + 1) * sizeof(OLECHAR));
588 memcpy(new_rep->key, Key, (new_rep->key_len+1)*sizeof(OLECHAR));
590 len = lstrlenW(item)+1;
591 new_rep->item = HeapAlloc(GetProcessHeap(), 0, len*sizeof(OLECHAR));
592 memcpy(new_rep->item, item, len*sizeof(OLECHAR));
594 new_rep->next = This->rep;
600 static HRESULT WINAPI Registrar_ClearReplacements(IRegistrar *iface)
602 Registrar *This = impl_from_IRegistrar(iface);
603 rep_list *iter, *iter2;
605 TRACE("(%p)\n", This);
613 HeapFree(GetProcessHeap(), 0, iter->key);
614 HeapFree(GetProcessHeap(), 0, iter->item);
615 HeapFree(GetProcessHeap(), 0, iter);
623 static HRESULT WINAPI Registrar_ResourceRegisterSz(IRegistrar* iface, LPCOLESTR resFileName,
624 LPCOLESTR szID, LPCOLESTR szType)
626 Registrar *This = impl_from_IRegistrar(iface);
627 TRACE("(%p)->(%s %s %s)\n", This, debugstr_w(resFileName), debugstr_w(szID), debugstr_w(szType));
628 return resource_register(This, resFileName, szID, szType, TRUE);
631 static HRESULT WINAPI Registrar_ResourceUnregisterSz(IRegistrar* iface, LPCOLESTR resFileName,
632 LPCOLESTR szID, LPCOLESTR szType)
634 Registrar *This = impl_from_IRegistrar(iface);
635 TRACE("(%p)->(%s %s %s)\n", This, debugstr_w(resFileName), debugstr_w(szID), debugstr_w(szType));
636 return resource_register(This, resFileName, szID, szType, FALSE);
639 static HRESULT WINAPI Registrar_FileRegister(IRegistrar* iface, LPCOLESTR fileName)
641 Registrar *This = impl_from_IRegistrar(iface);
642 TRACE("(%p)->(%s)\n", This, debugstr_w(fileName));
643 return file_register(This, fileName, TRUE);
646 static HRESULT WINAPI Registrar_FileUnregister(IRegistrar* iface, LPCOLESTR fileName)
648 Registrar *This = impl_from_IRegistrar(iface);
649 FIXME("(%p)->(%s)\n", This, debugstr_w(fileName));
650 return file_register(This, fileName, FALSE);
653 static HRESULT WINAPI Registrar_StringRegister(IRegistrar* iface, LPCOLESTR data)
655 Registrar *This = impl_from_IRegistrar(iface);
656 TRACE("(%p)->(%s)\n", This, debugstr_w(data));
657 return string_register(This, data, TRUE);
660 static HRESULT WINAPI Registrar_StringUnregister(IRegistrar* iface, LPCOLESTR data)
662 Registrar *This = impl_from_IRegistrar(iface);
663 TRACE("(%p)->(%s)\n", This, debugstr_w(data));
664 return string_register(This, data, FALSE);
667 static HRESULT WINAPI Registrar_ResourceRegister(IRegistrar* iface, LPCOLESTR resFileName,
668 UINT nID, LPCOLESTR szType)
670 Registrar *This = impl_from_IRegistrar(iface);
671 TRACE("(%p)->(%s %d %s)\n", iface, debugstr_w(resFileName), nID, debugstr_w(szType));
672 return resource_register(This, resFileName, MAKEINTRESOURCEW(nID), szType, TRUE);
675 static HRESULT WINAPI Registrar_ResourceUnregister(IRegistrar* iface, LPCOLESTR resFileName,
676 UINT nID, LPCOLESTR szType)
678 Registrar *This = impl_from_IRegistrar(iface);
679 TRACE("(%p)->(%s %d %s)\n", This, debugstr_w(resFileName), nID, debugstr_w(szType));
680 return resource_register(This, resFileName, MAKEINTRESOURCEW(nID), szType, FALSE);
683 static const IRegistrarVtbl RegistrarVtbl = {
684 Registrar_QueryInterface,
687 Registrar_AddReplacement,
688 Registrar_ClearReplacements,
689 Registrar_ResourceRegisterSz,
690 Registrar_ResourceUnregisterSz,
691 Registrar_FileRegister,
692 Registrar_FileUnregister,
693 Registrar_StringRegister,
694 Registrar_StringUnregister,
695 Registrar_ResourceRegister,
696 Registrar_ResourceUnregister,
699 static HRESULT Registrar_create(const IUnknown *pUnkOuter, REFIID riid, void **ppvObject)
703 if(!IsEqualGUID(&IID_IUnknown, riid) && !IsEqualGUID(&IID_IRegistrar, riid))
704 return E_NOINTERFACE;
706 ret = HeapAlloc(GetProcessHeap(), 0, sizeof(Registrar));
707 ret->IRegistrar_iface.lpVtbl = &RegistrarVtbl;
712 InterlockedIncrement(&dll_count);
717 /**************************************************************
718 * ClassFactory implementation
721 static HRESULT WINAPI RegistrarCF_QueryInterface(IClassFactory *iface, REFIID riid, void **ppvObject)
723 TRACE("(%p)->(%s %p)\n", iface, debugstr_guid(riid), ppvObject);
725 if(IsEqualGUID(&IID_IUnknown, riid) || IsEqualGUID(&IID_IClassFactory, riid)) {
727 IClassFactory_AddRef( iface );
731 return E_NOINTERFACE;
734 static ULONG WINAPI RegistrarCF_AddRef(IClassFactory *iface)
736 InterlockedIncrement(&dll_count);
740 static ULONG WINAPI RegistrarCF_Release(IClassFactory *iface)
742 InterlockedDecrement(&dll_count);
746 static HRESULT WINAPI RegistrarCF_CreateInstance(IClassFactory *iface, LPUNKNOWN pUnkOuter,
747 REFIID riid, void **ppvObject)
749 TRACE("(%p)->(%s %p)\n", iface, debugstr_guid(riid), ppvObject);
750 return Registrar_create(pUnkOuter, riid, ppvObject);
753 static HRESULT WINAPI RegistrarCF_LockServer(IClassFactory *iface, BOOL lock)
755 TRACE("(%p)->(%x)\n", iface, lock);
758 InterlockedIncrement(&dll_count);
760 InterlockedDecrement(&dll_count);
765 static const IClassFactoryVtbl IRegistrarCFVtbl = {
766 RegistrarCF_QueryInterface,
769 RegistrarCF_CreateInstance,
770 RegistrarCF_LockServer
773 static IClassFactory RegistrarCF = { &IRegistrarCFVtbl };
775 /**************************************************************
776 * DllGetClassObject (ATL.2)
778 HRESULT WINAPI DllGetClassObject(REFCLSID clsid, REFIID riid, LPVOID *ppvObject)
780 TRACE("(%s %s %p)\n", debugstr_guid(clsid), debugstr_guid(riid), ppvObject);
782 if(IsEqualGUID(&CLSID_Registrar, clsid))
783 return IClassFactory_QueryInterface( &RegistrarCF, riid, ppvObject );
785 FIXME("Not supported class %s\n", debugstr_guid(clsid));
786 return CLASS_E_CLASSNOTAVAILABLE;
789 extern HINSTANCE hInst;
791 static HRESULT do_register_dll_server(IRegistrar *pRegistrar, LPCOLESTR wszDll,
792 LPCOLESTR wszId, BOOL do_register,
793 const struct _ATL_REGMAP_ENTRY* pMapEntries)
795 IRegistrar *registrar;
797 const struct _ATL_REGMAP_ENTRY *pMapEntry;
799 static const WCHAR wszModule[] = {'M','O','D','U','L','E',0};
800 static const WCHAR wszRegistry[] = {'R','E','G','I','S','T','R','Y',0};
803 registrar = pRegistrar;
805 Registrar_create(NULL, &IID_IRegistrar, (void**)®istrar);
807 IRegistrar_AddReplacement(registrar, wszModule, wszDll);
809 for (pMapEntry = pMapEntries; pMapEntry && pMapEntry->szKey; pMapEntry++)
810 IRegistrar_AddReplacement(registrar, pMapEntry->szKey, pMapEntry->szData);
813 hres = IRegistrar_ResourceRegisterSz(registrar, wszDll, wszId, wszRegistry);
815 hres = IRegistrar_ResourceUnregisterSz(registrar, wszDll, wszId, wszRegistry);
817 if(registrar != pRegistrar)
818 IRegistrar_Release(registrar);
822 /***********************************************************************
823 * AtlModuleUpdateRegistryFromResourceD [ATL.@]
826 HRESULT WINAPI AtlModuleUpdateRegistryFromResourceD(_ATL_MODULEW* pM, LPCOLESTR lpszRes,
827 BOOL bRegister, struct _ATL_REGMAP_ENTRY* pMapEntries, IRegistrar* pReg)
829 HINSTANCE lhInst = pM->m_hInst;
830 /* everything inside this function below this point
831 * should go into atl71.AtlUpdateRegistryFromResourceD
833 WCHAR module_name[MAX_PATH];
835 if(!GetModuleFileNameW(lhInst, module_name, MAX_PATH)) {
836 FIXME("hinst %p: did not get module name\n",
841 TRACE("%p (%s), %s, %d, %p, %p\n", hInst, debugstr_w(module_name),
842 debugstr_w(lpszRes), bRegister, pMapEntries, pReg);
844 return do_register_dll_server(pReg, module_name, lpszRes, bRegister, pMapEntries);
847 /***********************************************************************
848 * DllRegisterServer (ATL.@)
850 HRESULT WINAPI DllRegisterServer(void)
852 return __wine_register_resources( hInst );
855 /***********************************************************************
856 * DllUnRegisterServer (ATL.@)
858 HRESULT WINAPI DllUnregisterServer(void)
860 return __wine_unregister_resources( hInst );
863 /***********************************************************************
864 * DllCanUnloadNow (ATL.@)
866 HRESULT WINAPI DllCanUnloadNow(void)
868 TRACE("dll_count = %u\n", dll_count);
869 return dll_count ? S_FALSE : S_OK;