Author: akhaldi
Date: Sat Feb 28 10:11:51 2015
New Revision: 66485
URL:
http://svn.reactos.org/svn/reactos?rev=66485&view=rev
Log:
[NETSHELL] Simplify registration by using an rgs file. Brought to you by Giannis
Adamopoulos. CORE-9276
Added:
trunk/reactos/dll/shellext/netshell/res/netshell.rgs
Modified:
trunk/reactos/dll/shellext/netshell/netshell.cpp
trunk/reactos/dll/shellext/netshell/netshell.rc
trunk/reactos/dll/shellext/netshell/resource.h
Modified: trunk/reactos/dll/shellext/netshell/netshell.cpp
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/shellext/netshell/nets…
==============================================================================
--- trunk/reactos/dll/shellext/netshell/netshell.cpp [iso-8859-1] (original)
+++ trunk/reactos/dll/shellext/netshell/netshell.cpp [iso-8859-1] Sat Feb 28 10:11:51
2015
@@ -4,13 +4,12 @@
HINSTANCE netshell_hInstance;
-static const WCHAR szNetConnectClass[] =
L"CLSID\\{7007ACC7-3202-11D1-AAD2-00805FC1270E}";
-static const WCHAR szLanConnectUI[] =
L"CLSID\\{7007ACC5-3202-11D1-AAD2-00805FC1270E}";
-static const WCHAR szLanConnectStatusUI[] =
L"CLSID\\{7007ACCF-3202-11D1-AAD2-00805FC1270E}";
-static const WCHAR szNamespaceKey[] =
L"SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Explorer\\ControlPanel\\NameSpace\\{7007ACC7-3202-11D1-AAD2-00805FC1270E}";
-
extern "C"
{
+
+/* FIXME: rpcproxy.h */
+HRESULT __wine_register_resources(HMODULE module);
+HRESULT __wine_unregister_resources(HMODULE module);
BOOL
WINAPI
@@ -39,94 +38,13 @@
STDAPI
DllRegisterServer(void)
{
- HKEY hKey, hSubKey;
- WCHAR szName[MAX_PATH+20] = {0};
- WCHAR szNet[20];
- UINT Length, Offset;
-
-
- if (RegCreateKeyExW(HKEY_CLASSES_ROOT, szNetConnectClass, 0, NULL, 0, KEY_WRITE,
NULL, &hKey, NULL) != ERROR_SUCCESS)
- return SELFREG_E_CLASS;
-
- if (LoadStringW(netshell_hInstance, IDS_NETWORKCONNECTION, szName, MAX_PATH))
- {
- szName[MAX_PATH-1] = L'\0';
- RegSetValueW(hKey, NULL, REG_SZ, szName, (wcslen(szName)+1) * sizeof(WCHAR));
- }
-
- if (RegCreateKeyExW(HKEY_LOCAL_MACHINE, szNamespaceKey, 0, NULL, 0, KEY_WRITE, NULL,
&hSubKey, NULL) == ERROR_SUCCESS)
- {
- RegSetValueW(hSubKey, NULL, REG_SZ, szName, (wcslen(szName)+1) * sizeof(WCHAR));
- RegCloseKey(hSubKey);
- }
-
- Length = swprintf(szNet, L",-%u", IDS_NETWORKCONNECTION);
- Offset = GetModuleFileNameW(netshell_hInstance, &szName[1],
(sizeof(szName)/sizeof(WCHAR))-1);
- if (Offset + Length + 2 < MAX_PATH)
- {
- /* set localized name */
- szName[0] = L'@';
- wcscpy(&szName[Offset+1], szNet);
- RegSetValueExW(hKey, L"LocalizedString", 0, REG_SZ, (const
LPBYTE)szName, (wcslen(szName)+1) * sizeof(WCHAR));
- }
-
- szName[Offset+1] = L'\0';
-
- /* store default icon */
- if (RegCreateKeyExW(hKey, L"DefaultIcon", 0, NULL, 0, KEY_WRITE, NULL,
&hSubKey, NULL) == ERROR_SUCCESS)
- {
- RegSetValueW(hSubKey, NULL, REG_SZ, &szName[1], (Offset+1) * sizeof(WCHAR));
- RegCloseKey(hSubKey);
- }
- if (RegCreateKeyExW(hKey, L"InProcServer32", 0, NULL, 0, KEY_WRITE, NULL,
&hSubKey, NULL) == ERROR_SUCCESS)
- {
- RegSetValueW(hSubKey, NULL, REG_SZ, &szName[1], (Offset+1) * sizeof(WCHAR));
- RegSetValueExW(hSubKey, L"ThreadingModel", 0, REG_SZ,
(LPBYTE)L"Both", 10);
- RegCloseKey(hSubKey);
- }
-
- if (RegCreateKeyExW(hKey, L"ShellFolder", 0, NULL, 0, KEY_WRITE, NULL,
&hSubKey, NULL) == ERROR_SUCCESS)
- {
- DWORD dwAttributes = SFGAO_FOLDER;
- RegSetValueExW(hSubKey, L"Attributes",0, REG_BINARY, (const
LPBYTE)&dwAttributes, sizeof(DWORD));
- }
-
- RegCloseKey(hKey);
-
- if (RegCreateKeyExW(HKEY_CLASSES_ROOT, szLanConnectUI, 0, NULL, 0, KEY_WRITE, NULL,
&hKey, NULL) != ERROR_SUCCESS)
- return SELFREG_E_CLASS;
-
- if (RegCreateKeyExW(hKey, L"InProcServer32", 0, NULL, 0, KEY_WRITE, NULL,
&hSubKey, NULL) == ERROR_SUCCESS)
- {
- RegSetValueW(hSubKey, NULL, REG_SZ, &szName[1], (Offset+1) * sizeof(WCHAR));
- RegSetValueExW(hSubKey, L"ThreadingModel", 0, REG_SZ,
(LPBYTE)L"Both", 10);
- RegCloseKey(hSubKey);
- }
-
- RegCloseKey(hKey);
-
- if (RegCreateKeyExW(HKEY_CLASSES_ROOT, szLanConnectStatusUI, 0, NULL, 0, KEY_WRITE,
NULL, &hKey, NULL) != ERROR_SUCCESS)
- return SELFREG_E_CLASS;
-
- if (RegCreateKeyExW(hKey, L"InProcServer32", 0, NULL, 0, KEY_WRITE, NULL,
&hSubKey, NULL) == ERROR_SUCCESS)
- {
- RegSetValueW(hSubKey, NULL, REG_SZ, &szName[1], (Offset+1) * sizeof(WCHAR));
- RegSetValueExW(hSubKey, L"ThreadingModel", 0, REG_SZ,
(LPBYTE)L"Both", 10);
- RegCloseKey(hSubKey);
- }
-
- RegCloseKey(hKey);
-
-
- return S_OK;
+ return __wine_register_resources(netshell_hInstance);
}
STDAPI
DllUnregisterServer(void)
{
- SHDeleteKeyW(HKEY_CLASSES_ROOT, szNetConnectClass);
- SHDeleteKeyW(HKEY_LOCAL_MACHINE, szNamespaceKey);
- return S_OK;
+ return __wine_unregister_resources(netshell_hInstance);
}
STDAPI
Modified: trunk/reactos/dll/shellext/netshell/netshell.rc
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/shellext/netshell/nets…
==============================================================================
--- trunk/reactos/dll/shellext/netshell/netshell.rc [iso-8859-1] (original)
+++ trunk/reactos/dll/shellext/netshell/netshell.rc [iso-8859-1] Sat Feb 28 10:11:51 2015
@@ -21,6 +21,8 @@
IDI_NET_REC ICON "res/netrec.ico"
IDI_NET_TRANS ICON "res/nettrans.ico"
IDI_NET_TRANSREC ICON "res/nettrrec.ico"
+
+IDR_NETSHELL REGISTRY "res/netshell.rgs"
/* UTF-8 */
#pragma code_page(65001)
Added: trunk/reactos/dll/shellext/netshell/res/netshell.rgs
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/shellext/netshell/res/…
==============================================================================
--- trunk/reactos/dll/shellext/netshell/res/netshell.rgs (added)
+++ trunk/reactos/dll/shellext/netshell/res/netshell.rgs [iso-8859-1] Sat Feb 28 10:11:51
2015
@@ -0,0 +1,60 @@
+HKCR
+{
+ NoRemove CLSID
+ {
+ ForceRemove {7007ACC7-3202-11D1-AAD2-00805FC1270E} = s 'Network
Connections'
+ {
+ InprocServer32 = s '%MODULE%'
+ {
+ val ThreadingModel = s 'Both'
+ }
+ DefaultIcon = s '%MODULE%'
+ ShellFolder
+ {
+ val Attributes = d '0x00000020'
+ }
+ val LocalizedString = s '@%MODULE%,-10000'
+ }
+ ForceRemove {7007ACC5-3202-11D1-AAD2-00805FC1270E} = s 'Network
Connections'
+ {
+ InprocServer32 = s '%MODULE%'
+ {
+ val ThreadingModel = s 'Both'
+ }
+ }
+ ForceRemove {7007ACCF-3202-11D1-AAD2-00805FC1270E} = s 'Network
Connections'
+ {
+ InprocServer32 = s '%MODULE%'
+ {
+ val ThreadingModel = s 'Both'
+ }
+ }
+ }
+}
+HKLM
+{
+ NoRemove Software
+ {
+ NoRemove Microsoft
+ {
+ NoRemove Windows
+ {
+ NoRemove CurrentVersion
+ {
+ NoRemove Explorer
+ {
+ NoRemove MyComputer
+ {
+ NoRemove NameSpace
+ {
+ ForceRemove {7007ACC7-3202-11D1-AAD2-00805FC1270E} = s 'Network
Connections'
+ {
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+}
Modified: trunk/reactos/dll/shellext/netshell/resource.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/shellext/netshell/reso…
==============================================================================
--- trunk/reactos/dll/shellext/netshell/resource.h [iso-8859-1] (original)
+++ trunk/reactos/dll/shellext/netshell/resource.h [iso-8859-1] Sat Feb 28 10:11:51 2015
@@ -94,3 +94,5 @@
#define IDS_WINS_SERVERS 10308
#define IDS_PROPERTY 10309
#define IDS_VALUE 10310
+
+#define IDR_NETSHELL 20000