mirror of
https://github.com/reactos/reactos.git
synced 2025-01-03 21:09:19 +00:00
[NETSHELL] Simplify registration by using an rgs file. Brought to you by Giannis Adamopoulos. CORE-9276
svn path=/trunk/; revision=66485
This commit is contained in:
parent
1a045cb4b3
commit
7eb3fcf1d5
4 changed files with 70 additions and 88 deletions
|
@ -4,14 +4,13 @@
|
|||
|
||||
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
|
||||
DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID fImpLoad)
|
||||
|
@ -39,94 +38,13 @@ DllCanUnloadNow(void)
|
|||
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
|
||||
|
|
|
@ -22,6 +22,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)
|
||||
|
||||
|
|
60
reactos/dll/shellext/netshell/res/netshell.rgs
Normal file
60
reactos/dll/shellext/netshell/res/netshell.rgs
Normal file
|
@ -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'
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -94,3 +94,5 @@
|
|||
#define IDS_WINS_SERVERS 10308
|
||||
#define IDS_PROPERTY 10309
|
||||
#define IDS_VALUE 10310
|
||||
|
||||
#define IDR_NETSHELL 20000
|
||||
|
|
Loading…
Reference in a new issue